# Maintainer: David Runge <dvzrv@archlinux.org>

_name=pytest-rerunfailures
pkgname=python-pytest-rerunfailures
pkgver=11.1.2
pkgrel=2
pkgdesc="A plugin for py.test that re-runs failed tests to eliminate intermittent failures"
arch=(any)
url="https://github.com/pytest-dev/pytest-rerunfailures/"
license=(MPL2)
depends=(python-packaging python-pytest)
makedepends=(python-build python-installer python-setuptools python-wheel)
checkdepends=(python-pytest-xdist)
optdepends=(
  'python-pytest-xdist: for recovering from crashes'
)
source=(https://files.pythonhosted.org/packages/source/${_name::1}/$_name/$_name-$pkgver.tar.gz)
sha512sums=('309a0d180a996ddb5d6eb0833e6abd107887bc17ca3003a2b02bbaf5a4cbd63012618ee293a2a80623ca327b46ce7a5cd53bb341de75e5670a62b84e7ce5f0bc')
b2sums=('c497fee173f09de42d605d092336105e7144aafcdcfe6cdfbe3df65e09c3ab5cf0bc2d42746662f792c832ac25538f3cd81dc97d6e01201b14b480cb0e2d3a46')

build() {
  cd $_name-$pkgver
  python -m build --wheel --no-isolation
}

check() {
  cd $_name-$pkgver
  pytest -vv -k 'not test_rerun_passes_after_temporary_test_crash'
}

package() {
  cd $_name-$pkgver
  python -m installer --destdir="$pkgdir" dist/*.whl
  install -vDm 644 {CHANGES.rst,README.rst} -t "$pkgdir/usr/share/doc/$pkgname/"
}
